//登录
function login(token) {
    let data = {
        "code":"0",
        "open_id":1234, //用户自己的open_id
        "is_new": true,
        "data":{add_step:0,
            all_step:0,
            money:0} ,   //用户存储的数据 没有则传null
        "app_list":[{app_id:"",title:"",des:""}]
    }
    return resolveDelay(data)
}


// 刷新数据
function refreshData(encryptedData,iv,nickName,avatarUrl) {
    let data = {data:{data: {reward_step_list: {1: 10200,2: 864,3: 95,4: 4219,5:8},
                all_step: 2312,
                money: 1500,
                invite_num: 0},
            code: 0}
    }
    return resolveDelay(data)
}

// 获取新增步数
function getNewAddSteps() {
    let data = {
        "code":"0",
        "all_step":3500
    }
    return resolveDelay(data)
}

function NewAddSteps() {
    let data = {
        "all_step":0
    }
}

function resolveDelay(data) {
    return new Promise(function(resolve, reject) {
        setTimeout(() => {
            resolve(data)
        }, 200)
    })
}

// 模拟邀请好友接口
function invate(What){
    let data = {
        "isSuccess":true
    }
    return resolveDelay(data)
}

module.exports = {
    login,
    refreshData,
    getNewAddSteps,
    invate,
    NewAddSteps
}
